<template>
	<view class="content hwq-content">
		<!-- 事件归档 -->
		<navBar title="事件归档"   @goBack="goBack"></navBar>
		<searchCom v-model="searchText"></searchCom>
		<scroll-view scroll-y="true" class="hwq-scroll-box hwq-is-search">
			<view class="swipe-action" v-for="item in list" :key="item.id" @click="clickItem(item)">
				<view class="top-box">
					<view class="name">{{item.bizProjectName||''}}</view>
					<view class="point">{{item.sectionName||""}}/{{item.siteName||''}}</view>
				</view>
				<view class="bottom-box">
					<view class="department">{{item.orgName||""}}</view>
					<view class="time">{{item.startTime2||''}}</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		getListByNameByLike
	} from "@/api/emergency/emergencyDispatch.js"
	import searchCom from "@/components/searchCom.vue"
	import mixins from "@/utils/mixins.js"
	export default {
		mixins: [mixins],
		data() {
			return {
				searchText: undefined,
				list: []
			}
		},
		components: {
			searchCom
		},
		mounted() {
			this.getList()
		},
		methods: {
			clickItem(item) {
				uni.navigateTo({
					url: `/pages/eventArchiving/filingDetails`,
					success(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('setData', {
							data: item
						})
					}
				})
			},
			
			
			async getList(){
				let _query = {
					currPage: 1,
					pageSize: 10000,
					params: {
						orgId: "", // 组织id
						state: 1
					}
				}
				let res = await getListByNameByLike(_query)
				res.result.list.forEach(item => {
					item.startTime2 = this.getDate2(item.startTime)
					switch (item.state) {
						case 0:
							item.stateText = '处置中'
							break
						case 1:
							item.stateText = '归档'
							break
					}
				})
				this.list = res.result.list
				console.log(this.list,'list')
			},
			
			goBack(url){
				uni.switchTab({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		.swipe-action {
			padding-top: 10rpx;

			.top-box {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #22204E;
				line-height: 70rpx;
				display: flex;
				justify-content: space-between;
				padding-right: 20rpx;

				.point {
					color: #445469;
				}
			}

			.bottom-box {
				font-size: 24rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #6A819E;
				line-height: 36rpx;
				display: flex;
				justify-content: space-between;
				border-bottom: 2rpx solid #E2E5ED;
				padding-right: 20rpx;

				.department {
					padding-bottom: 32rpx;
				}

				.time {
					color: #6A819E;
					float: right;
				}
			}
		}
	}
</style>
